package com.vdong.data.model;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;

import com.vdong.data.model.enums.State;
import org.hibernate.annotations.GenericGenerator;

/**
 * The persistent class for the template database table.
 */
@Entity
@NamedQuery(name = "Template.findAll", query = "SELECT t FROM Template t")
public class Template implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @GeneratedValue(generator = "system-uuid")
    private String id;

    @OneToMany(cascade = {CascadeType.REMOVE}, mappedBy = "template", fetch = FetchType.LAZY)
    private List<TemplateCarryMode> templateCarryMode;

    private String userId;
    private LocalDateTime createTime;

    private String name;

    private State state;

    private LocalDateTime updateTime;

    private String usersKey;

    public Template() {
    }

    public String getUsersKey() {
        return usersKey;
    }

    public void setUsersKey(String usersKey) {
        this.usersKey = usersKey;
    }

    public String getId() {
        return this.id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public void setId(String id) {
        this.id = id;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public State getState() {
        return state;
    }

    public void setState(State state) {
        this.state = state;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public List<TemplateCarryMode> getTemplateCarryMode() {
        return templateCarryMode;
    }

    public void setTemplateCarryMode(List<TemplateCarryMode> templateCarryMode) {
        this.templateCarryMode = templateCarryMode;
    }

    @Override
    public String toString() {
        return "Template [id=" + id + ", templateCarryMode=" + templateCarryMode + ", userId=" + userId
                + ", createTime=" + createTime + ", name=" + name + ", state=" + state + ", updateTime=" + updateTime
                + "]";
    }

}